#ifndef JSON_OBJECT_H
#define JSON_OBJECT_H

#include "JsonValue.h"

namespace simframework
{
	namespace json
	{
		class Array;
		class Object
		{
		public:
			explicit Object(std::wostream& js);

			Object(const Object& other);

			~Object();

			Object startObject(const std::wstring& key);

			Array startArray(const std::wstring& key);

			template <typename T>
			void insert(const std::wstring& key, const T& value)
			{
				writeKey(key);
				Value::add(value, m_jsonStream);			
			}		

		protected:

		private:
			void writeKey(const std::wstring& key);
			Object& operator=(const Object&);
			std::wostream& m_jsonStream;
			bool m_isFirstElement;
		};
	};
}

#endif //JSON_OBJECT_H